<template>
   <div class="template2">
    <el-container style="height:100%;">
      <div class="head" id="head1">
        <div class="tit">报告模板
          <el-button type="info" size="mini" @click="serverType('1')" plain :class="serverTypeId==1?'act':''" style="margin-left:20px;">精装</el-button>
          <el-button type="info" size="mini" @click="serverType('0')" plain :class="serverTypeId==0?'act':''">毛坯</el-button>
          <!-- <el-button type="info" size="mini" plain>监理</el-button> -->
        </div>
      </div>
      <el-main style="height:100%" class="report">
        <largeClass></largeClass>
        <subclass></subclass>
      </el-main>
    </el-container>
    <addSub></addSub>
    <addLarge></addLarge>
    <addProblem></addProblem>
  </div>
</template>
<script>
import largeClass from './largeClass.vue'
import subclass from './subclass.vue'
import addSub from './addSub.vue'
import addLarge from './addLarge.vue'
import addProblem from './addProblem.vue'
import { request } from "../../assets/request.js";
export default {
    data() {
    return {
      defaultProps: {
        children: "children",
        label: "label"
      },
      height: "",
      formInline: {
        user: "",
        region: ""
      },
      serverTypeId:1
    };
  },
  created(){
    this.positionList()
  },
  methods:{
    handleNodeClick(data) {

    },
    onSubmit() {
      console.log("submit!");
    },
    addSub(){
        this.$root.$emit('addSub','on')
    },
    addLarge(){
        this.$root.$emit('addLarge','on')
    },
    addProblem(){
      this.$root.$emit('addProblem','on')
    },
    serverType(type){
      let that=this
      this.serverTypeId=parseInt(type)
      this.$root.$emit('serverType',that.serverTypeId)
    },
    saveLarge(){
      this.$root.$emit('saveLarge','on')
    },
    positionList(){
      let url = "houses/location";
      let that=this   //解决this指向问题
      if(that.$store.state.positionList !=''){
        return
      }
      request.ajaxGet({
          url,
          that,
          fn(res){
            that.$store.state.positionList=res.list
          }
      })
    }
  },
  components:{
      largeClass,   //大类列表
      subclass,   //子类列表
      addLarge,   //添加大类
      addSub,     //添加子类
      addProblem, //添加问题
  }
}
</script>
<style lang="less" scoped>
@import "../template2.less";
</style>
<style lang="less" scoped>
.template2{
  padding: 60px 0px 0px 0px;
  .report{
    display: flex;
    justify-content:center;
    background:#f5f5f5;
    height: 100% !important;
  }
  .act{
    background:#909399;
    color:#ffffff;
  }
}
</style>
